package com.jfs.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Description 消息方法指令枚举类
 * @E-mail cwm3412638@163.com
 * @Author cwm
 * @Date 2022-08-23
 */
@Getter
@AllArgsConstructor
public enum MessageEnum {
    /**
     * 心跳命令
     */
    MESSAGE_KEEP_ALIVE("Keepalive", "<CmdType>Keepalive</CmdType>", "心跳命令"),
    MESSAGE_DEVICE_INFO("DeviceInfo", "<CmdType>DeviceInfo</CmdType>", "查询设备详情命令"),
    MESSAGE_CATA_LOG("Catalog", "<CmdType>Catalog</CmdType>", "查询目录列表"),
    MESSAGE_DEVICE_STATUS("DeviceStatus", "<CmdType>DeviceStatus</CmdType>", "查询设备状态"),
    MESSAGE_CONFIG_DOWNLOAD("ConfigDownload","<CmdType>ConfigDownload</CmdType>","查询设备配置");
    /**
     * 命令名
     */
    private final String name;
    /**
     * 指令
     */
    private final String cmd;
    /**
     * 描述
     */
    private final String describe;

    /**
     * 根据名称获取枚举
     *
     * @param eqName
     * @return
     */
    public static MessageEnum getMethodEnumByName(String eqName) {
        MessageEnum[] values = MessageEnum.values();
        for (MessageEnum messageEnum : values
        ) {
            if (messageEnum.name.equals(eqName)) {
                return messageEnum;
            }
        }
        return null;
    }
}
